package com.gjy.design.responsibility.r1;

/**
 * @author gjy
 * @version 1.0
 * @since 2025-11-11 11:08:19
 */
public class Demo {

    public static void main(String[] args) {
        // 构建责任链：A -> B
        Handler handlerA = new ConcreteHandlerA();
        Handler handlerB = new ConcreteHandlerB();
        handlerA.setNext(handlerB);

        // 发送请求
        // handlerA.handleRequest("A"); // 输出: HandlerA 处理了请求: A
        handlerA.handleRequest("B"); // 输出: HandlerB 处理了请求: B
        handlerA.handleRequest("C"); // 无输出（无处理者处理）
    }

}
